.TH "UNICORN" "3" "Jan 27th 2025" "Unicorn 1.0.4"
.SH NAME
unimemfunc \- memory allocation function
.SH LIBRARY
Embeddable Unicode Algorithms (libunicorn, -lunicorn)
.SH SYNOPSIS
.nf
.B #include <unicorn.h>
.PP
.BI "typedef void *(*unimemfunc)(void *" user_data ", void *" ptr ", size_t " old_size ", size_t " new_size ");"
.fi
.SH DESCRIPTION
Defines the function signature for a custom memory management implementation.
The memory manager is responsible for allocating, reallocating, and free’ing memory.
The implementation must behave like \f[B]realloc\f[R](3) or \f[B]free\f[R](3) depending upon its arguments.
.PP
When \f[I]new_size\f[R] is non-zero, the allocator must behave like \f[B]realloc\f[R](3).
If \f[I]ptr\f[R] is NULL and \f[I]old_size\f[R] is zero, the allocator must behave like \f[B]malloc\f[R](3).
.PP
When \f[I]new_size\f[R] is zero, the allocator must behave like \f[B]free\f[R](3).
It must also return NULL to the caller.
.SH SEE ALSO
.BR uni_setmemfunc (3)
.SH AUTHOR
.UR https://railgunlabs.com
Railgun Labs
.UE .
.SH INTERNET RESOURCES
The online documentation is published on the
.UR https://railgunlabs.com/unicorn
Railgun Labs website
.UE .
.SH LICENSING
Unicorn is distributed with its end-user license agreement (EULA).
Please review the agreement for information on terms & conditions for accessing or otherwise using Unicorn and for a DISCLAIMER OF ALL WARRANTIES.
